import { computed } from 'vue';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';

export const columns = (t: (key: string) => string) => {
  return computed<TableColumnData[]>(() => [
    {
      title: t('searchTable.columns.index'),
      dataIndex: 'id',
      slotName: 'id',
      align: 'center',
      width: 60,
    },
    {
      title: t('searchTable.columns.path'),
      dataIndex: 'path',
      slotName: 'path',
      align: 'center',
      width: 150,
    },
    {
      title: t('searchTable.columns.desc'),
      dataIndex: 'desc',
      align: 'center',
      width: 120,
    },
    {
      title: t('searchTable.columns.api_group'),
      dataIndex: 'api_group',
      align: 'center',
      width: 80,
    },
    {
      title: t('searchTable.columns.method'),
      dataIndex: 'method',
      slotName: 'method',
      align: 'center',
      width: 80,
    },
    {
      title: t('searchTable.columns.defaultState'),
      dataIndex: 'defaultState',
      slotName: 'defaultState',
      align: 'center',
      width: 80,
    },
    {
      title: t('searchTable.columns.state'),
      dataIndex: 'state',
      slotName: 'state',
      align: 'center',
      width: 80,
    },
    {
      title: t('searchTable.columns.operations'),
      dataIndex: 'operations',
      slotName: 'operations',
      align: 'center',
      fixed: 'right',
      width: 100,
    },
  ]);
};
